A process and circuit for resampling and resizing a digital image where each iteration converts each n pixels on a scan line to an average pixel to resample to 1/n in the horizontal direction, and outputs one scan line for every n, plus or minus a small percentage, input scan lines to resample and resize the image in the vertical direction.
It is frequently necessary to change the size of an image slightly. For example, deleting alternate pixels will reduce an image to one half, and duplicating pixels will double the image size. To change image size by less than a multiple of two, an algorithm such as the nearest neighbor algorithm can be used to produce the necessary number of pixels.
It may also be necessary to resample image pixels. For example, if an image is scanned in on a scanner of higher pixel density and is to be processed or printed at a lower pixel density, conversion to a lower number of pixels per inch is required.
However, if image pixels are deleted in either of these processes, data will be lost. To minimize this, the pixels can be averaged first. That is, a number of pixels can be replaced by one average pixel.
The result of these operations is an image that is resampled and changed slightly in size while losing a minimum of image quality.
This process can be used in color copiers, as a first step in the prevention of counterfeiting. In its simplest form, paper currency can be counterfeited by placing it on the platen and copying it. To prevent this, currency has marks of various sizes, shapes and colors. The image output of the scanner can be analyzed, and the copying discontinued if a currency mark of a particular size is found by a currency detection circuit in the copier. To defeat this detection, a counterfeiter may set the scanner to magnify the image size enough so that the marks will not be recognized by the currency detector, and then reduce the image by the same amount when printing.
To prevent this, the detection circuit must be supplied with a number corresponding to the amount of magnification (or reduction) that the scanner was set to, and must reduce (increase) the image size by the same amount before testing for currency marks.
Additionally, the pixel density of the image is greater than that needed by the detection circuit, so the data is resampled first. With the addition of the averaging of the image pixels, the total process becomes averaging, sizing and resampling.
The final problem is that of circuit speed. When an original of any kind is placed on the platen, the copier can not start to print until the test for currency is complete, and since this test must be done for every original, the elapsed time must be as short as possible. There is therefore a need for an algorithm that can implemented in a pipe-lined circuit so that the elapsed time is minimized.
In this discussion, as an aid in understanding a numerical example will be used where the resampling will be assumed to be 4 to 1, and the resizing will be assumed to be between plus or minus 20%.
A typical color copier makes small changes in image size by slowing down the speed of the paper in the vertical, or slow scan direction, but in the fast scan direction the clock remains unchanged, and therefore the copier can only change the image size slightly by using a nearest neighbor algorithm to change the density of pixels in the horizontal, or fast scan, direction.
Therefore, in the horizontal direction, all that is required is resampling the pixels before the image is resized, and that is accomplished by averaging four pixels at a time, and using the result as the sampled pixel.
However, in the vertical direction, an image change of up to plus or minus 20% will also have to be made by using a reduction factor of between 3 and 5 to 1, this reduction being made by deleting the proper number of intervening scan lines.
A circuit for accomplishing all of this in a small amount of time is needed